package com.ruoyi.aitcommon.service;

import org.springframework.stereotype.Service;

import com.ruoyi.aitcommon.anotation.ServiceLog;
import com.ruoyi.aitcommon.utils.LogUtils;

/**
 * 日志输出服务,用于FLow执行中的日志输出
 * @author Administrator
 *
 */
@Service
public class LogService {
	/**
	 * 输出Info
	 * @param obj
	 */
	@ServiceLog("LogInfo")
	public void info(Object obj) {
		LogUtils.info(obj.toString());
	}
	/**
	 * 输出Error
	 * @param obj
	 */
	@ServiceLog("LogError")
	public void error(Object obj) {
		LogUtils.error(obj.toString());
	}
	/**
	 * 输出Info
	 * @param obj 输出消息
	 * @param sleep 停顿时间(秒)
	 */
	@ServiceLog("SleepLogInfo")
	public void sleepInfo(Object obj,long sleep) {
		try {
			Thread.sleep(sleep*1000);
			LogUtils.info(obj.toString());
		}catch(Exception ex) {
			
		}
		
	}
	
	public void exception(Object obj) throws Exception {
		LogUtils.error(obj.toString());
		throw new Exception(obj.toString());
	}
}
